﻿<%@ Page Language="C#" %>

<%@ Import Namespace="wojilu" %>
<%@ Import Namespace="wojilu.View" %>
<%@ Import Namespace="wojilu.Apps.Qycms.Domain" %>
<%@ Import Namespace="wojilu.Apps.Qycms.Service" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>#{softtitle}</title>
<link href="#{path.css}ybb/css/baselist.css?v=#{cssVersion}" rel="stylesheet" type="text/css" />
<link href="#{path.css}ybb/css/all.css?v=#{cssVersion}" rel="stylesheet" type="text/css" />
<link href="#{path.css}ybb/css/formdiv.css?v=#{cssVersion}" rel="stylesheet" type="text/css"/>
<link href="#{path.css}ybb/css/jcrop.css?v=#{cssVersion}" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="#{path.js}ybb/js/jquery.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="#{path.js}ybb/js/control.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="#{path.js}ybb/js/form.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="#{path.js}ybb/js/jcrop.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="#{path.js}ybb/js/imagejcrop.js?v=#{jsVersion}"></script>
<script type="text/javascript" language="JavaScript">
var resizewindow= null;
window.onresize = function(){
	var h = $(window).height();
	if(resizewindow!=h){
		sizewindow();
		resizewindow=h;
	}
}
function sizewindow(){
	var h = $(window).height();
	if(document.getElementById("mainbodybottonauto")){
		$('.managebottonadd').css({height:h-40});
	}
}
var filemanage_js_newimagename_empty = "_{filemanage_js_newimagename_empty}";
var filemanage_js_size_empty = "_{filemanage_js_size_empty}";
var filemanage_js_edit_ok = "_{filemanage_js_edit_ok}";
var filemanage_js_edit_no = "_{filemanage_js_edit_no}";
var filemanage_js_zoomwidthbig_empty = "_{filemanage_js_zoomwidthbig_empty}";
var filemanage_js_zoomheightbig_empty = "_{filemanage_js_zoomheightbig_empty}";
var iframename = "#{iframename}";
iframename = iframename=='' ? "jerichotabiframe_0" : iframename;
$(window).load(function(){
    var h = '#{iframeheightwindow}';
	$('.managebottonadd').css({height:h-40});
	var jcrop_api;
	
	setTimeout("initJcrop()",100);
	$('#release').click(function(e) {
		jcrop_api.release();
	});
	var options = {
		beforeSubmit: formverify,
		success:saveResponse,
		resetForm: false
	}
	$('#filecheck').submit(function() {
		$(this).ajaxSubmit(options);
		return false;
	});
});
function initJcrop(){
	jcrop_api = $.Jcrop('#cropbox',{

		onChange: updateCoords,
		onSelect: updateCoords
	});
}

function formverify(formData, jqForm, options) {
	var queryString = $.param(formData);
	var get=urlarray(queryString);
	if(get['newimagename'].match(/^[\w.]+$/ig)==null) {
		document.filecheck.newimagename.focus();
		alert(filemanage_js_newimagename_empty);
		return false;
	}
	if(get['w'].match(/^[0-9]+$/ig)==null || get['h'].match(/^[0-9]+$/ig)==null || get['x'].match(/^[0-9]+$/ig)==null || get['y'].match(/^[0-9]+$/ig)==null) {
		alert(filemanage_js_size_empty);
		return false;
	}
	parent.windowsdig('Loading','iframe:#{load}','400px','180px','iframe',false);
}
function saveResponse(options){
	parent.closeifram();
	if (options=='true'){
		parent.frames[iframename].refresh('selectform','selectall','check_all');
		alert(filemanage_js_edit_ok);
	}else{
		alert(filemanage_js_edit_no+" "+options);
	}
	parent.onaletdoc()
}
</script>
</head>

<body class="bodyflow">
<form name="filecheck" id="filecheck" method="post" action="#{ActionLink}">
<input type="hidden" name="path" id="path" value="#{path}"/>
<input type="hidden" name="imgname" id="imgname" value="#{imgname}"/>
<input type="hidden" name="imgW" id="imgW" value="#{srcW}"/>
<input type="hidden" name="imgH" id="imgH" value="#{srcH}"/>
<div id="mainbodybottonauto" class="managebottonadd">
	<div class="maindobycontent">
		<div class="suggestion">
			<span class="sugicon"><span class="strong colorgorning2">_{position_title}</span><span class="padding-left5 colorgorningage">_{filemanage_file_zoom_botton_title}</span></span>
		</div>
		<div class="manageeditdiv" id="filecheckmanger">
			<div class="maneditcontent">
				<table class="formtable">			
					<tr class="trstyle2">
						<td class="trtitle01">_{filemanage_file_imgname_title}</td>
						<td class="trtitle02">#{imgname}</td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle01">_{filemanage_file_selecton_title}</td>
						<td class="trtitle02">
							<input type="radio" value="1" name="selecton" checked="checked" onclick="showdiv(1,'#newsfilediv','0|1','trstyle2 displaytrue|trstyle2 displaynone',1,0)"> _{is_yes}&nbsp;
							<input type="radio" value="0" name="selecton" onclick="showdiv(0,'#newsfilediv','0|1','trstyle2 displaytrue|trstyle2 displaynone',1,0)"> _{is_no}
						</td>
					</tr>
					<tr class="trstyle2 displaynone" id="newsfilediv">
						<td class="trtitle01">_{filemanage_file_newimagename_title}</td>
						<td class="trtitle02">
							<input type="text" name="newimagename" value="#{newfilename}" maxlength="100" size="40" class="infoInput">
							<span class="cautiontitle">_{filemanage_file_rename_newdirname_mess}</span>
						</td>
					</tr>
					<tr class="trstyle2">
						<td class="trtitle01">_{filemanage_file_zoombotton_title}</td>
						<td class="trtitle02">
							_{filemanage_file_zoombotton_width}<input id="dstW" class="infoInput" type="text" name="dstW" maxlength="3" size="3" value="#{srcW}"  onBlur="javascript:imagesizew();" style="ime-mode:disabled" onkeydown="if(event.keyCode==13)event.keyCode=9" onKeyPress="if ((event.keyCode<48 || event.keyCode>57)) event.returnValue=false"/>
							_{filemanage_file_zoombotton_height}<input id="dstH" class="infoInput" type="text" name="dstH" maxlength="3" size="3" value="#{srcH}" onBlur="javascript:imagesizeh();" style="ime-mode:disabled" onkeydown="if(event.keyCode==13)event.keyCode=9" onKeyPress="if ((event.keyCode<48 || event.keyCode>57)) event.returnValue=false"/>
							<input type="button" id="chenimage" class="bottons02" name="chenimage" onclick="imagezoom('#imagelist', '_{filemanage_file_zoombotton_mess}');" value="_{filemanage_file_zoombotton}"/>
						</td>
					</tr>
					<tr class="trstyle2" id="select1">
						<td class="trtitle01">_{filemanage_file_zoom_info}</td>
						<td class="trtitle02" align="left">
							_{filemanage_file_zoombotton_width}<input type="text" id="w" name="w" size="3" class="infoInput"/>
							_{filemanage_file_zoombotton_height}<input type="text" id="h" name="h" size="3" class="infoInput"/>
							_{filemanage_file_zoombotton_x}<input type="text" id="x" name="x" size="3" class="infoInput"/>
							_{filemanage_file_zoombotton_y}<input type="text" id="y" name="y" size="3" class="infoInput"/>
						</td>
					</tr>
					<tr class="trstyle2">
						<td colspan="2" style="padding:5px;" align="center"><span id="imagelist"><img id="cropbox" src="#{url}"></span></td>
						<!--<td colspan="2" style="padding:5px;" align="center"><span id="imagelist"><img id="cropbox" src="[%$url%][%$imgname%]"></span></td>-->
					</tr>
				</table>
			</div>
		</div>
	</div>
</div>
<div id="downbotton">
	<div id="subbotton">
		<table border="0" style="margin: 0 auto;">
			<tr id="bottonsubmit">
				<td ><input type="submit" name="Submit" id="submitbotton" value="_{filemanage_file_submit_botton}" class="buttonface" title="_{filemanage_file_submit_botton}"/></td>
				<td class="padding-left5"><input type="reset" name="reset" id="release" value="_{filemanage_file_res_botton}" class="buttonface"  title="_{filemanage_file_res_botton}" /></td>
				<td class="padding-left5"><input type="button" name="cancel" onClick="javascript:closewindow();" value="_{botton_edit_reset}" class="buttonface" /></td>
			</tr>
		</table>
	</div>
</div>
</form>
</body>
</html>